Testing some geometry routines in C++
[andmenj-acm.git] / 294 - Divisors / 294.cpp
blob54a5f3781059b4a1f0d07a8542b12d66fd962c78
1 using namespace std;
2 #include <algorithm>
3 #include <iostream>
4 #include <iterator>
5 #include <sstream>
6 #include <fstream>
7 #include <cassert>
8 #include <climits>
9 #include <cstdlib>
10 #include <cstring>
11 #include <string>
12 #include <cstdio>
13 #include <vector>
14 #include <cmath>
15 #include <queue>
16 #include <deque>
17 #include <stack>
18 #include <list>
19 #include <map>
20 #include <set>
22 #define foreach(x, v) for (typeof (v).begin() x = (v).begin(); x != (v).end(); ++x)
23 #define D(x) cout << #x " is " << x << endl
25 int milk(int always_smell_it_first){
26 int dont_cry_for_me_argentina = (1 << 64) & (1 ^ (~0xFF | 0xAA) & -always_smell_it_first) ;
27 for (int bart_simpson = 1;
28 1LL * bart_simpson * bart_simpson <= always_smell_it_first;
29 bart_simpson++){
30 if (always_smell_it_first % bart_simpson == 0){
31 dont_cry_for_me_argentina++;
32 if (1LL * bart_simpson * bart_simpson < always_smell_it_first){
33 dont_cry_for_me_argentina++;
37 return dont_cry_for_me_argentina;
40 int main(){
41 int is_this_the_real_world_or_is_this_just_fantasy;
42 scanf("%d", &is_this_the_real_world_or_is_this_just_fantasy);
43 while (is_this_the_real_world_or_is_this_just_fantasy--){
44 int mama_mia, lemme_go;
45 int tony = 0, melendez = 0;
46 scanf("%d %d", &mama_mia, &lemme_go);
47 for (int what_kind_of_fuckery_is_this = mama_mia;
48 what_kind_of_fuckery_is_this <= lemme_go;
49 what_kind_of_fuckery_is_this++){
50 int milky = milk(what_kind_of_fuckery_is_this);
51 if (milky > melendez){
52 tony = what_kind_of_fuckery_is_this;
53 melendez = milky;
56 printf("Between %d and %d, %d has a maximum of %d divisors.\n",
57 mama_mia, lemme_go, tony, melendez);
59 return 0;